//
// Created by LONG on 2020/9/28.
//


#include <cstdint>
#include <cstring>
#include <assert.h>
#include "commDef.h"
#include "../../src/ccore/include/commDef.h"

uint32_t gCnDebugCodeSave[CN_DEBUG_CODE_BUTT] = { 0 };
uint32_t gRanDebugCodeSave[RAN_DEBUG_CODE_BUTT] = { 0 };
uint32_t gUeDebugCodeSave[UE_DEBUG_CODE_BUTT] = { 0 };

void UT_SAVE_ALL_DBG_CODE()
{
    memcpy(gCnDebugCodeSave, gCnDebugCode, sizeof(gCnDebugCodeSave));
    memcpy(gRanDebugCodeSave, gRanDebugCode, sizeof(gRanDebugCodeSave));
    memcpy(gUeDebugCodeSave, gUeDebugCode, sizeof(gUeDebugCodeSave));
}

uint32_t UT_GET_DBG_CODE(int32_t app, int32_t dc)
{
    if (app == APP_TYPE_CN)
    {
        return gCnDebugCode[dc];
    }
    if (app == APP_TYPE_RAN)
    {
        return gRanDebugCode[dc];
    }
    if (app == APP_TYPE_UE)
    {
        return gUeDebugCode[dc];
    }
    assert(0);
}

uint32_t UT_GET_SAVE_DBG_CODE(int32_t app, int32_t dc)
{
    if (app == APP_TYPE_CN)
    {
        return gCnDebugCodeSave[dc];
    }
    if (app == APP_TYPE_RAN)
    {
        return gRanDebugCodeSave[dc];
    }
    if (app == APP_TYPE_UE)
    {
        return gUeDebugCodeSave[dc];
    }
    assert(0);
}